/**
 * Created by sunbowen on 2018/1/12.
 */
function isEmail(email) {
    var pattern= /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    var strEmail=pattern.test(email);
    if(strEmail){
        //邮箱格式正确
        return true;
    }else{
        //邮箱格式不正确
        return false;
    }
}
//判断手机号码
function isPoneAvailable(str) {
    var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
    if (!myreg.test(str)) {
        return false;
    } else {
        return true;
    }
}
//判断身份证格式
function doChange(srcObj){
    var tegx=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
    var result1=srcObj.match(tegx);
    if(result1==null){
        return false;
    }else{
        return true;
    }
}
//金额保留两位小数
function changeTwoDecimal_f(x) {
    var f_x = parseFloat(x);
    if (isNaN(f_x)) {
        alert('function:changeTwoDecimal->parameter error');
        return false;
    }
    var f_x = Math.round(x * 100) / 100;
    var s_x = f_x.toString();
    var pos_decimal = s_x.indexOf('.');
    if (pos_decimal < 0) {
        pos_decimal = s_x.length;
        s_x += '.';
    }
    while (s_x.length <= pos_decimal + 2) {
        s_x += '0';
    }
    return s_x;
}